<%@ page language="java" contentType="text/html;charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>SWFUpload Demos - Simple Demo</title>
<style type="text/css">
.upload-label
{
	width:220px;
}
.bd_upload {
    border: 1px solid #4E86C4;
}
.upload-label .attchUploadstyle {
    border-width: 2px;
    font-size: 0;
    height: 6px;
    margin: 0 5px 0 0;
    overflow: hidden;
    width: 100px;
}
.upload-label .attchUploadstyle .fdbody {
    border: 0 none;
    float: left;
    height: 6px;
    overflow: hidden;
    background: none repeat scroll 0% 0% rgb(137, 181, 233);
    padding: 0;
    width: 34%;
}
.upload-label .upload_ctrl {
    color: red;
    cursor: default;
    margin-right: 5px;
}

BODY {
 BACKGROUND: #333; MARGIN: 200px 0px
}
.content {
 MARGIN: auto; WIDTH: 50px
}
.content H1 {
 FONT-WEIGHT: bold; FONT-SIZE: 14px; MARGIN-BOTTOM: 10px; COLOR: #31b8da; TEXT-ALIGN: center
}
.load {
 BORDER-RIGHT: #222 1px solid;
 PADDING-RIGHT: 1px;
  BORDER-TOP: #000 1px solid;
   PADDING-LEFT: 1px;
    BACKGROUND: #2c2c2c;
     PADDING-BOTTOM: 1px;
      BORDER-LEFT: #000 1px solid;
       PADDING-TOP: 1px; BORDER-BOTTOM: #222 1px solid
}
.load SPAN {
 DISPLAY: block; BACKGROUND: #31b8da; OVERFLOW: hidden;  HEIGHT: 4px
}
</style>
<link href="static/css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="static/js/jquery-easyui-1.2.5/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="static/js/swfupload.js"></script>
<script type="text/javascript" src="static/js/swfupload.queue.js"></script>
<script type="text/javascript" src="static/js/fileprogress.js"></script>
<script type="text/javascript" src="static/js/handlers.js"></script>
<script type="text/javascript">
		var swfu;
		window.onload = function() {
			var settings = {
				flash_url : "static/swf/swfupload.swf",
				upload_url: "http://localhost:8080/cashback/doSwfUpload",
				post_params: {"JSESSIONID" : "<?php echo session_id(); ?>"},
				file_size_limit :"2040MB",
				file_types : "*.*",
				file_types_description : "All Files",
				file_upload_limit : 100,
				file_queue_limit : 0,
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel"
				},
				debug: false,

				// Button settings
				//button_image_url: "../../image/TestImageNoText_65x29.png",
				button_width: "65",
				button_height: "29",
				button_placeholder_id: "spanButtonPlaceHolder",
				button_text: '<span style="font-size:12">添加附件</span>',
				button_text_style: ".theFont { font-size: 16; }",
				button_text_left_padding: 12,
				button_text_top_padding: 3,
				
				// The event handler functions are defined in handlers.js
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : questart,//uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : swfcomplete,//uploadSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
				/* // The event handler functions are defined in handlers.js
				file_queued_handler : function(){console.log('fileQueued')},
				file_queue_error_handler : function(){console.log('fileQueueError')},
				file_dialog_complete_handler : function(){console.log('dialog_complete')},
				upload_start_handler : function(){console.log('start')},
				upload_progress_handler : function(){console.log('uploadProgress')},
				upload_error_handler : function(){console.log('uploadError')},
				upload_success_handler : function(){console.log('uploadSuccess')},
				upload_complete_handler : function(){console.log('uploadComplete')},
				queue_complete_handler : function(){console.log('queueComplete')}	// Queue plugin event */
			};

			swfu = new SWFUpload(settings);
	     };
	</script>
</head>
<body>
<!-- <div id="header">
	<h1 id="logo"><a href="../">SWFUpload</a></h1>
	<div id="version">v2.2.0</div>
</div> -->

<div id="content">
	<form id="form1" action="index.php" method="post" enctype="multipart/form-data">
		<!-- <p>This page demonstrates a simple usage of SWFUpload.  It uses the Queue Plugin to simplify uploading or cancelling all queued files.</p> -->

			<div class="fieldset flash" id="fsUploadProgress" style="height:100px;over-flow:scroll;"/>
			<span class="legend">队列</span>
			</div>
		<div id="divStatus">0 Files Uploaded</div>
			<div>
				<span id="spanButtonPlaceHolder"></span>
				<input id="btnCancel" type="button" value="Cancel All Uploads" onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />
		</div>
		<input type="file" id="multi_file"/>
		
		<div id="multi_list" style="width:800px;"></div>
		<div id="res_list"></div>
	</form>
</div>
<DIV id="content">
<H1>网站正在制作中</H1>
<DIV id="load"><SPAN></SPAN></DIV></DIV>
<script type="text/javascript">
function uploadProgress(file, bytesLoaded, bytesTotal) {
	try {
		console.log('uploadProgress');
		var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);

		var progress = new FileProgress(file, this.customSettings.progressTarget);
		progress.setProgress(percent);
		progress.setStatus("上传中...");
	} catch (ex) {
		this.debug(ex);
	}
}
function questart(){
	var args = Array.prototype.slice.call(arguments,0);
	var file = args[0];
	var bytesLoaded = args[1];
	var bytesTotal = args[2];
	var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
	 
	var  createAble = !document.getElementById('p_'+file.name);
	if(createAble)
		{
			var r = $('<div class="upload-label"></div>');
	    	var a = $('<span class="" title="正在上传">'+file.name+'</span>');
		   var b =$('<span id="ps_'+file.name+'" class="bd_upload attchUploadstyle"></span>');
		   var pbody =$('<div id="p_'+file.name+'" class="fdbody"></div>');
		   var c = $('<a id="r_'+file.name+'" style="display:none;" href="#multi_file_wrap">删除</a>');
		  
		   b.append(pbody);
		   b.css('display','block');
		   $('#multi_list').append(
			    	r.append(c,' ',a, ' ', b)
		   );
		}
	 	document.getElementById('p_'+file.name).style.width=percent+'%';
}
function swfcomplete(){
	var args = Array.prototype.slice.call(arguments,0);
	var file = args[0],fileName=file.name;
	var data = args[1];
	var response = args[2];
    var progress = document.getElementById('ps_'+fileName);
    var removeBtn = document.getElementById('r_'+fileName);
    if(progress)
   	{
    	progress.style.display = 'none';
    	removeBtn.style.display = 'inline';
    	removeBtn.onclick=function(){
			var attachList = removeBtn.parentNode.parentNode;
    		var uploadLabel = removeBtn.parentNode;
    		attachList.removeChild(uploadLabel);
    	};
   	}
}
/* $(function(){
	$('#multi_file').MultiFile({
		list: '#res_list'
	});
}); */
</script>
</body>
</html>
